Concurrent programming for shared-memory multiprocessors can include the ability for multiple threads to access the same data. The multiple threads execute on multiple processors, multiple logical processor cores, or other classes of parallelism that are attached to a memory shared between the processors. The shared-memory model is the most commonly deployed method of multithread communication. In such systems, concurrent threads can attempt to access and modify the same data in the shared-memory. This can lead to data race conditions, which can create other undesired or potentially harmful effects in concurrent programming and the stored data.
A data race occurs in a multithreaded program when at least two concurrent threads access the same memory location without synchronization where at least one of the accesses is a write operation. Data races indicate a programming error, which can be difficult to isolate because of the non-deterministic features of multithreaded programming. The schedule of threads is timing sensitive, and data races are difficult to reproduce even when the concurrent program is repeatedly executed with the same inputs. To make matter more difficult, data races often result in corrupted memory in shared data structures that do not result in immediate failures of the program, and bugs resulting from data races may not manifest until later executed portions of the concurrent program as mysterious failures in unrelated portions of code.
Researchers have attempted to develop automated tools for detecting data races in concurrent programs. Static data race detection techniques generally provide comprehensive coverage of the concurrent program by reasoning data races on all execution paths. Static techniques, however, tend to over estimate assumptions that can lead to a large number of falsely detected data races. Dynamic data race detection techniques are more precise than static techniques, but their coverage is limited to execution paths and interleaving occurring during runtime. Dynamic techniques, however, often incur debilitating performance overheads of up to a two hundred times slowdown in certain unmanaged programs. Large performance overheads have prevented the wide-scale adoption of dynamic data race detectors in practice.